Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix frontend deprecations #10198

Merged
merged 8 commits into from
Dec 15, 2024
Merged

Conversation

eth3lbert
Copy link
Contributor

This PR should hopefully fix the remaining deprecations :)

@eth3lbert eth3lbert force-pushed the fix-frontend-deprecated branch from c84b9f9 to f6e066b Compare December 13, 2024 10:15
app/routes/crate/index.js Outdated Show resolved Hide resolved
@eth3lbert eth3lbert force-pushed the fix-frontend-deprecated branch from f6e066b to 39651f8 Compare December 13, 2024 11:02
@Turbo87 Turbo87 added A-frontend 🐹 C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear labels Dec 13, 2024
@eth3lbert eth3lbert force-pushed the fix-frontend-deprecated branch from 39651f8 to ae57cf5 Compare December 15, 2024 03:27
This fixes deprecations:
- Do not use A() on an EmberData PromiseManyArray
…h a task

This fixes the following deprecations:
 - The get method on ember-data's PromiseManyArray is deprecated.
This fixes the following deprecations:
- The toArray method on ember-data's PromiseManyArray is deprecated.
- The `toArray` method on the class ManyArray is deprecated.

by explicitly loading `owners` with a task.
This extracts functionality from `isOwner` as a more generic method.
The data is loaded explicitly with `loadOwnerUserTask` to avoid
deprecations. A debugging assert is also included to inform if perform()
is not called before using it.
This fixes the following deprecations:
- The findBy method on ember-data's PromiseManyArray is deprecated.
- The `findBy` method on the class ManyArray is deprecated.
This fixes the following deprecations:
- The removeObject method on ember-data's PromiseManyArray is deprecated.
- The `removeObject` method on the class ManyArray is deprecated.
A debugging assert is also included to inform missing `perform()` called
before accessing getters.

This fix the following deprecations:
- The toArray method on ember-data's PromiseManyArray is deprecated.
- The `toArray` method on the class ManyArray is deprecated.
This fixes the following deprecations:
- The `firstObject` method on the class ManyArray is deprecated.
@eth3lbert eth3lbert force-pushed the fix-frontend-deprecated branch from ae57cf5 to ac1a774 Compare December 15, 2024 04:24
let crate = this.modelFor('crate');
controller.set('crate', crate);
// TODO: Add error handling
waitForPromise(crate.loadVersionsTask.perform());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it makes more sense to call this task in the model() or at least afterModel() hooks, so that the data is fully loaded before the route displays anything. I don't know why it was originally implemented this way.

I guess this is a non-blocking concern though, since the code previously used the same pattern 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although implementing it this way could potentially be more complex, it would also be more responsive, as it could display all other elements (layout, crate header) before the versions are ready (a loading indicator for this hasn't been implemented yet).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yeah, I mostly implemented it following the previous pattern. But I guess putting this either in model() or afterModel() should also work for non-blocking purposes, just note not to await for it.

@Turbo87 Turbo87 merged commit 31e2ae1 into rust-lang:main Dec 15, 2024
9 checks passed
@eth3lbert eth3lbert deleted the fix-frontend-deprecated branch December 15, 2024 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants